1. Field of the Invention
The present invention relates to a pattern matching method and pattern matching apparatus for performing pattern matching between a search edge image generated based on a search image, and a model edge image generated based on a detection target.
2. Description of the Related Art
In the field of image processing, pattern matching methods are conventionally well known as methods of detecting the position of, e.g., a work as a detection target. Of these methods, shape pattern matching (to be referred to as pattern matching hereinafter) has widely spread because it is a method which is strong against an illumination change and the hiding and missing of an object and has a high robustness.
In the pattern matching, the similarity is calculated by using the shape features of a model (reference image) and search image, so it is necessary to extract the shape features of the images. As a method of extracting the shape feature, an edge extraction method such as a Sobel filter or Canny filter is generally known. Since edge extraction for a model can be performed before an actual search process, the processing time poses almost no problem. However, edge extraction for a search image (i.e., image to be searched) must be performed simultaneously with an actual search process. Therefore, it is important to shorten the processing time for the actual search process.
To solve this problem, a pattern matching method has been proposed by which an edge extraction domain as a target of edge extraction is narrowed down to a part of a search image, thereby making the processing speed higher than that when performing edge extraction for the entire search image (see Japanese Patent Application Laid-Open No. 2010-091525). This pattern matching method generates a model edge image by extracting only an edge near the corner of a detection target as a model edge image. In an actual search process, corner detection is first performed on a search image, edge extraction is then performed in only a peripheral domain of the detected corner, and pattern matching is performed using a pregenerated model edge image of the corner. Since the domain as an edge extraction target is thus narrowed down to the periphery of the corner, the processing time can be made shorter than that when performing edge extraction on the entire search image.
In the pattern matching method described in Japanese Patent Application Laid-Open No. 2010-091525, however, a detection target must have a corner. This makes the method inapplicable to a detection target having no corner such as a circle. Also, if a corner-like shape which is not a detection target exists in the background of the detection target, the method detects the corner other than the detection target, and hence cannot narrow down the edge extraction domain.
The present invention provides a pattern matching method and pattern matching apparatus capable of increasing the speed of a pattern matching process by specifying an edge extraction domain from a search image without using any specific shape feature such as a corner.